package cn.kaguyaever.service.impl;

import cn.kaguyaever.dao.CandidateDao;
import cn.kaguyaever.dao.impl.CandidateDaoImpl;
import cn.kaguyaever.entity.Candidate;
import cn.kaguyaever.service.CandidateService;

import java.util.List;

public class CandidateServiceImpl implements CandidateService {

    private CandidateDao candidateDao = new CandidateDaoImpl();

    public void createCandidate(Candidate candidate){
        candidateDao.createCandidate(candidate);
    }

    public List<Candidate> queryCandidate(String voteId){
        return candidateDao.queryAllCandidateByVoteId(voteId);
    }

    public void voteCandidate(Integer candidateId){
        candidateDao.voteCandidate(candidateId);
    }

    public void deleteCandidate(String voteId){candidateDao.deleteCandidate(voteId);}
}
